package com.ruoyi.course.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.course.mapper.SelectCourseMapper;
import com.ruoyi.course.domain.SelectCourse;
import com.ruoyi.course.service.ISelectCourseService;

/**
 * selectCourseService业务层处理
 * 
 * @author Weiney
 * @date 2025-02-24
 */
@Service
public class SelectCourseServiceImpl implements ISelectCourseService 
{
    @Autowired
    private SelectCourseMapper selectCourseMapper;

    /**
     * 查询selectCourse
     * 
     * @param courseId selectCourse主键
     * @return selectCourse
     */
    @Override
    public SelectCourse selectSelectCourseByCourseId(Long courseId)
    {
        return selectCourseMapper.selectSelectCourseByCourseId(courseId);
    }

    /**
     * 查询selectCourse列表
     * 
     * @param selectCourse selectCourse
     * @return selectCourse
     */
    @Override
    public List<SelectCourse> selectSelectCourseList(SelectCourse selectCourse)
    {
        return selectCourseMapper.selectSelectCourseList(selectCourse);
    }

    /**
     * 新增selectCourse
     * 
     * @param selectCourse selectCourse
     * @return 结果
     */
    @Override
    public int insertSelectCourse(SelectCourse selectCourse)
    {
        return selectCourseMapper.insertSelectCourse(selectCourse);
    }

    /**
     * 修改selectCourse
     * 
     * @param selectCourse selectCourse
     * @return 结果
     */
    @Override
    public int updateSelectCourse(SelectCourse selectCourse)
    {
        return selectCourseMapper.updateSelectCourse(selectCourse);
    }

    /**
     * 批量删除selectCourse
     * 
     * @param courseIds 需要删除的selectCourse主键
     * @return 结果
     */
    @Override
    public int deleteSelectCourseByCourseIds(Long[] courseIds)
    {
        return selectCourseMapper.deleteSelectCourseByCourseIds(courseIds);
    }

    /**
     * 删除selectCourse信息
     * 
     * @param courseId selectCourse主键
     * @return 结果
     */
    @Override
    public int deleteSelectCourseByCourseId(Long courseId)
    {
        return selectCourseMapper.deleteSelectCourseByCourseId(courseId);
    }

    /**
     * 根据课程 ID 查询 my_selected_course 表的 userId 和 deptId 映射
     * @param courseId 课程 ID
     * @return 以 userId 为键，deptId 为值的 Map
     */
    @Override
    public List<Map<Long, Long>> getUserIdsAndDeptIdsByCourseId(Long courseId) {
        return selectCourseMapper.getUserIdsAndDeptIdsByCourseId(courseId);
    }
}
